package com.cykj.order.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.cykj.common.core.web.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 订单表 bs_orders
 */

@TableName("bs_orders")
@Data
public class BsOrders extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /** 订单ID */
    @TableId(type = IdType.AUTO)
    private Long id;

    /** 订单编号 */
    private String orderNumber;

    /** 用户ID */
    private Long userId;

    /** 订单总价 */
    private BigDecimal totalAmount;

    /** 商品总价 */
    private BigDecimal productAmount;

    /** 使用的优惠券ID */
    private Long couponId;

    /** 总优惠金额 */
    private BigDecimal discountAmount;

    /** 地址ID */
    private Long addressId;

    /** 订单备注 */
    private String remark;

    /** 订单状态 */
    private Integer status;

    /** 支付时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date payTime;

    /** 完成时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date completeTime;

    /** 评价状态 */
    private Integer reviewStatus;

    /** 配送费 */
    private BigDecimal deliveryFee;

    /** 抽成规则ID */
    private Long commissionRuleId;

    /** 平台抽成金额 */
    private BigDecimal commissionAmount;

    /** 店铺ID */
    private Long shopId;

    /** 支付方式 */
    private Integer paymentMethod;

    /** 取消原因 */
    private String cancelReason;


    /** 下单结束时间（查询用） */

    @TableField(exist = false) // 关键：告诉MyBatis-Plus该字段不是表列
    private String userPhone; // 用户手机号后四位（关联用户表获取）

    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date beginTime; // 下单开始时间（查询条件）

    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date endTime; // 下单结束时间（查询条件）

    @TableField(exist = false)
    private String userName; // 用户名（关联用户表获取）

    @TableField(exist = false)
    private String shopName; // 店


    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getShopName() {
        return shopName;
    }

    public void setShopName(String shopName) {
        this.shopName = shopName;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getOrderNumber() {
        return orderNumber;
    }

    public void setOrderNumber(String orderNumber) {
        this.orderNumber = orderNumber;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public BigDecimal getTotalAmount() {
        return totalAmount;
    }

    public void setTotalAmount(BigDecimal totalAmount) {
        this.totalAmount = totalAmount;
    }

    public BigDecimal getProductAmount() {
        return productAmount;
    }

    public void setProductAmount(BigDecimal productAmount) {
        this.productAmount = productAmount;
    }

    public Long getCouponId() {
        return couponId;
    }

    public void setCouponId(Long couponId) {
        this.couponId = couponId;
    }

    public BigDecimal getDiscountAmount() {
        return discountAmount;
    }

    public void setDiscountAmount(BigDecimal discountAmount) {
        this.discountAmount = discountAmount;
    }

    public Long getAddressId() {
        return addressId;
    }

    public void setAddressId(Long addressId) {
        this.addressId = addressId;
    }

    @Override
    public String getRemark() {
        return remark;
    }

    @Override
    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Date getPayTime() {
        return payTime;
    }

    public void setPayTime(Date payTime) {
        this.payTime = payTime;
    }

    public Date getCompleteTime() {
        return completeTime;
    }

    public void setCompleteTime(Date completeTime) {
        this.completeTime = completeTime;
    }

    public Integer getReviewStatus() {
        return reviewStatus;
    }

    public void setReviewStatus(Integer reviewStatus) {
        this.reviewStatus = reviewStatus;
    }

    public BigDecimal getDeliveryFee() {
        return deliveryFee;
    }

    public void setDeliveryFee(BigDecimal deliveryFee) {
        this.deliveryFee = deliveryFee;
    }

    public Long getCommissionRuleId() {
        return commissionRuleId;
    }

    public void setCommissionRuleId(Long commissionRuleId) {
        this.commissionRuleId = commissionRuleId;
    }

    public BigDecimal getCommissionAmount() {
        return commissionAmount;
    }

    public void setCommissionAmount(BigDecimal commissionAmount) {
        this.commissionAmount = commissionAmount;
    }

    public Long getShopId() {
        return shopId;
    }

    public void setShopId(Long shopId) {
        this.shopId = shopId;
    }

    public Integer getPaymentMethod() {
        return paymentMethod;
    }

    public void setPaymentMethod(Integer paymentMethod) {
        this.paymentMethod = paymentMethod;
    }

    public String getCancelReason() {
        return cancelReason;
    }

    public void setCancelReason(String cancelReason) {
        this.cancelReason = cancelReason;
    }

    public String getUserPhone() {
        return userPhone;
    }

    public void setUserPhone(String userPhone) {
        this.userPhone = userPhone;
    }

    public Date getBeginTime() {
        return beginTime;
    }

    public void setBeginTime(Date beginTime) {
        this.beginTime = beginTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    @Override
    public String toString() {
        return "BsOrders{" +
                "id=" + id +
                ", orderNumber='" + orderNumber + '\'' +
                ", userId=" + userId +
                ", totalAmount=" + totalAmount +
                ", productAmount=" + productAmount +
                ", couponId=" + couponId +
                ", discountAmount=" + discountAmount +
                ", addressId=" + addressId +
                ", remark='" + remark + '\'' +
                ", status=" + status +
                ", payTime=" + payTime +
                ", completeTime=" + completeTime +
                ", reviewStatus=" + reviewStatus +
                ", deliveryFee=" + deliveryFee +
                ", commissionRuleId=" + commissionRuleId +
                ", commissionAmount=" + commissionAmount +
                ", shopId=" + shopId +
                ", paymentMethod=" + paymentMethod +
                ", cancelReason='" + cancelReason + '\'' +
                ", userPhone='" + userPhone + '\'' +
                ", beginTime=" + beginTime +
                ", endTime=" + endTime +
                ", userName='" + userName + '\'' +
                ", shopName='" + shopName + '\'' +
                '}';
    }
}
